package servlet;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.servlet.*;
import java.util.*;



import model.EmailingSystem;
import model.InternalMail;
import model.PollUserImpl;
import bean.PollUser;

public class sendMessageServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 555666L;

	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost (request, response);
	}
	
	public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html");
		response.setCharacterEncoding("GBK");
		
		// Error checking
		System.out.println("doPost method of sendMessageServlet reached");
		/*
		// Get parameters
		String [] poll_list = request.getParameterValues("poll_list"); 
		String [] user_list = request.getParameterValues("pollUser_list");
		String message_text = request.getParameter("composeMessage_text");
		String privacy = request.getParameter("Privacy");
		// Get Poll Master username how??
		String sender = "";
		
		if (privacy.equals("public")) {
			InternalMail.publicMessage(sender, poll_list, message_text);
		}
		if (privacy.equals("private")) {
			InternalMail.privateMessage(sender, user_list, message_text);
		}
*/
		RequestDispatcher rd=request.getRequestDispatcher("ComposeMessage.jsp");
		rd.forward(request, response);
		
	}
	
}
